import request from '@/router/axios'
import { validatenull } from '@/util/validate'
const path = '/ykdjktjbs'
const zypath = '/ykdzyzlqkzyss' //住院治疗情况
const yyqkpath = '/ykdzyyyqks' //主要用药情况情况
const jzspath = '/ykdfmyghjzss' //非免疫规划预防接种史
//查找健康体检表
export function findObj(obj) {
  return request({
    url: `${path}/finds`,
    method: 'post',
    data: obj
  })
}
//保存健康体检表
export function saveObj(obj) {
  if (validatenull(obj.id)) {
    return request({
      url: `${path}`,
      method: 'post',
      data: obj
    })
  } else {
    return request({
      url: `${path}`,
      method: 'put',
      data: obj
    })
  }
}
//查找住院治疗情况
export function findZyList(query) {
  return request({
    url: `${zypath}`,
    method: 'get',
    params: query
  })
}
//删除住院治疗情况
export function delZyObj(id) {
  return request({
    url: `${zypath}/${id}`,
    method: 'delete'
  })
}
//添加住院治疗情况
export function addZyObj(obj) {
  return request({
    url: `${zypath}`,
    method: 'post',
    data: obj
  })
}
//修改住院治疗情况
export function updateZyObj(obj) {
  return request({
    url: `${zypath}`,
    method: 'put',
    data: obj
  })
}
//查找主要用药情况
export function findYyqkList(query) {
  return request({
    url: `${yyqkpath}`,
    method: 'get',
    params: query
  })
}
//删除主要用药情况
export function delYyqkObj(id) {
  return request({
    url: `${yyqkpath}/${id}`,
    method: 'delete'
  })
}
//添加主要用药情况
export function addYyqkObj(obj) {
  return request({
    url: `${yyqkpath}`,
    method: 'post',
    data: obj
  })
}
//修改主要用药情况
export function updateYyqkObj(obj) {
  return request({
    url: `${yyqkpath}`,
    method: 'put',
    data: obj
  })
}
//查找非免疫规划预防接种史
export function findJzsList(query) {
  return request({
    url: `${jzspath}`,
    method: 'get',
    params: query
  })
}
//删除非免疫规划预防接种史
export function delJzsObj(id) {
  return request({
    url: `${jzspath}/${id}`,
    method: 'delete'
  })
}
//添加非免疫规划预防接种史
export function addJzsObj(obj) {
  return request({
    url: `${jzspath}`,
    method: 'post',
    data: obj
  })
}
//修改非免疫规划预防接种史
export function updateJzsObj(obj) {
  return request({
    url: `${jzspath}`,
    method: 'put',
    data: obj
  })
}

export function findxy(obj) {
  return request({
    url: `/reportHealthmonitors/findxy`,
    method: 'post',
    data: obj
  })
}
